package t10086.Model.Entity.PrimaryKey;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;

import java.io.Serializable;
import java.util.Objects;

@Embeddable
public class DeliveryRecordPrimaryKey implements Serializable {

    @Column(name = "order_number")
    private String orderNumber;

    @Column(name = "serial_number")
    private String serialNumber;

    // Default constructor, getters, setters, equals, and hashCode

    public DeliveryRecordPrimaryKey() {
    }

    public DeliveryRecordPrimaryKey(String orderNumber, String serialNumber) {
        this.orderNumber = orderNumber;
        this.serialNumber = serialNumber;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeliveryRecordPrimaryKey that = (DeliveryRecordPrimaryKey) o;
        return Objects.equals(orderNumber, that.orderNumber) &&
                Objects.equals(serialNumber, that.serialNumber);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderNumber, serialNumber);
    }
    @Override
    public String toString() {
        return "[SerialNumber=" + serialNumber + ", OrderNumber=" + orderNumber + "]";
    }
}
